<template>
	<view class="content poRel">
		<view class="wid100 " style="height: 245rpx;background-color: #37BCC3;">
			<view class="wid90 mar">
				<view style="height: 50rpx;"></view>
				<view class="dis disAl disJuB">
					<view class="wid25" style="height: 122rpx;">
						<image :src="url+user.avatar" class="hei100 borRad50" style="width: 122rpx;"></image>
					</view>
					<view class="coFFF fowe600" style="width: 75%;">
						<view class="foSi40" style="line-height: 40rpx;">{{user.nickname}}</view>
						<view class="dis disAl disJuB mar-top10">
							<view class="foSi30">推荐人：{{parent_name}}</view>
							<view class="dis disAl foSi25 mar-top10" @click="copyText(user.id)">
								<view class="mar-right20">邀请码：{{user.id}}</view>
								<image src="../../static/fuzhi2.png" style="width: 18rpx;height: 20rpx;"></image>
							</view>
						</view>
						<!-- <view class="foSi30 mar-top10">分销等级：一级</view> -->
					</view>
				</view>
			</view>
		</view>
		<view class="wid90 mar borRad20 bacFFF dis disAl mar-top40" style="box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0,0,0,0.2);height: 146rpx;">
			<view class="wid100 dis disAl fowe800 foSi30" style="height: 85rpx;">
				<view class="wid33 textCen">
					<view>¥{{divide_money}}</view>
					<view class="mar-top10">累计佣金</view>
				</view>
				<view class="hei100" style="width: 1rpx;background-color: #DCDCDC;"></view>
				<view class="wid33 textCen">
					<view>¥{{rewards}}</view>
					<view class="mar-top10">可提现佣金</view>
				</view>
				<view class="hei100" style="width: 1rpx;background-color: #DCDCDC;"></view>
				<view class="wid33 dis disAl disJuC">
					<view class="borRad10 dis disAl disJuC coFFF hei60" style="background-color: #37BCC3;width: 122rpx;" @click="tiaozhuan('/pages/distribution/earnings')">提现</view>
				</view>
			</view>
		</view>
		<view class="wid90 mar borRad20 bacFFF dis disAl mar-top40" style="box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0,0,0,0.2);padding: 60rpx 0;">
			<view class="dis disAl wid90 mar" style="justify-content: space-around;">
				<view class="textCen" @click="tiaozhuan('/pages/distribution/earnings')">
					<view class="mar" style="width: 80rpx;height: 80rpx;">
						<image src="../../static/leijishouyi1.png" class="wh100"></image>
					</view>
					<view class="mar-top15 foSi30 fowe600">我的收益</view>
				</view>
				<view class="textCen" @click="tiaozhuan('/pages/distribution/group')">
					<view class="mar" style="width: 80rpx;height: 80rpx;">
						<image src="../../static/shouyituandui1.png" class="wh100"></image>
					</view>
					<view class="mar-top15 foSi30 fowe600">我的团队</view>
				</view>
				<view class="textCen" @click="tiaozhuan('/pages/distribution/client')">
					<view class="mar" style="width: 80rpx;height: 80rpx;">
						<image src="../../static/kehuleibiao1.png" class="wh100"></image>
					</view>
					<view class="mar-top15 foSi30 fowe600">我的客户</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				url: this.global.url,
				divide_money:0,
				rewards:0,
				parent_name:'',
				user:[]
			}
		},
		onLoad() {
			// this.userinfo()
		},
		onShow() {
			this.userinfo()
		},
		methods: {
			copyText(code) {
				uni.setClipboardData({
					data:code,
					success() {
						uni.showToast({
							title:'已复制到剪贴板',
							icon:'none',
							position:'top'
						})
					}
				})
			},
			userinfo(){
				var that = this;
				uni.request({
					url: that.global.url + '/api/qianyu_petrol/gasstation_user_son_list',
					method: "POST",
					header: {
						'site-id': that.global.site_id,//自定义请求头信息
						'token': uni.getStorageSync('token')
					},
					data: {},
					success(res) {
						let result = res.data
						console.log(result)
						if (result.code == 1) {
							that.parent_name = result.data.parent_name
							that.rewards = result.data.rewards
							that.divide_money = result.data.divide_money
							that.user = result.data.user
						}
					}
				})
			},
			tiaozhuan(url) {
				uni.navigateTo({
					url: url
				})
			}
		}
	}
</script>

<style>
	.content {}
	.xia{
		height: 1rpx;
		background-color: #A6A6A6;
	}
</style>